package geneComponent;

import base.Parameter;

import util.Log;

public class Terminal extends Node {

	public interface OnRequestParameterListenner {

		public abstract Parameter onRequestParameter(Parameter requestParam);

    }

	public Terminal(Parameter parameters) {
    	super(parameters);
    	typeParam =parameters.getValueToString(Parameter.TYPE_TERM_VALUE);
    	setName(typeParam);
    	terminal = true;
    }

    private String typeParam;
    private OnRequestParameterListenner onRequestParamListenner;

    public void setOnRequestParameterListenner(OnRequestParameterListenner listenner) {
    	onRequestParamListenner = listenner;
    }

	@Override
	public double getResult() {
	
		if(typeParam.equals(Parameter.TYPE_VALUE_PT)){
			setName(getName()/*+String.valueOf(job.getProcessingTime())*/);
			
	//		Log.debug(" 잡   index "+ job.getJobIndex() + " 잡  PT "+ job.getProcessingTime());
			return job.getProcessingTime();
		}
		
		else if(typeParam.equals(Parameter.TYPE_VALUE_RM)){
			setName(getName()/*+String.valueOf(machine.getReadyTime())*/);
			
	//		Log.debug("  머신 index " +machine.getIndex() + "   RM  " +machine.getEndTime());
			return machine.getEndTime();
		}
		
		else if(typeParam.equals(Parameter.TYPE_VALUE_CT)){
			setName(getName()/*+String.valueOf(machine.getTotalWorkingTime())*/);
	//		Log.debug("  현재시간 CT   "+schedule.getCurrentTime());
			return schedule.getCurrentTime();
		}		
	
		return super.getResult();
	}

}